@extends('layouts.home.layout')
@section('content')
    @include('layouts.home._nav')

    <div class="validation main">
        <form action="{{url('apply/onestep')}}" name="oneForm" id="oneForm" method="post">
            <input type="hidden" name="productid" value="{{$product_id}}">
            <div class="validation_title">
                <img src="{{asset('home')}}/images/yanzheng1_03.png" />
                <h1>请先验证个人信息</h1>
            </div>
            <div class="yzbox">
                <p>真实姓名</p>
                <input class="yzbox_input" name="name" />
            </div>
			<div class="yzbox">
            <p>性别</p>
            <div class="radiobox" style="border:none;">
                <input type="radio" name="sex" value="1"  class="xianjin"/><p>男</p>
                <input type="radio" name="sex" value="0" class="chuxuka"/><p>女</p>
            </div>
        </div>
            <div class="yzbox">
                <p>手机号码</p>
                <input class="yzbox_input" name="mobile" />
            </div>
            <div class="yzbox">
                <p>短信验证码</p>
                <div class="yanzhengma">
                    <input  placeholder="" name="code" class="code"/>
                    <button type="button" class="checkcell">获取验证码</button>
                </div>
            </div>
            <div class="yz_p"><input type="checkbox" name="isagree" class="isagree" /><p>我已阅读并同意<a href="javascript:void(0)">《泛兰士服务条款》</a></p></div>
            <button class="nextbtn subBtn" disabled>下一步</button>
        </form>
    </div>


    <script>
        var smsUrl = "{{url('sms/send')}}";
        //同意
        $('.isagree').change(function(){
            if($('.isagree').is(':checked')==true){
                $('.subBtn').attr('disabled',false)
            }else{
                $('.subBtn').attr('disabled',true)
            }
        });
        $(document).ready(function () {
            var twooptions = {
                success: function (data) {
                    $(".subBtn").attr('disabled',false);
                    layer.msg(data.message);
                    if(data.code=='0000'){
                        window.location.href="{{url('apply/twostep')}}"+'?recordid='+data.recordid;
                    }
                }
            };
            $(".subBtn").click(function () {
                var fm=document.forms['oneForm'];// HTML DOM 通过form 元素的name值获取
                //
                var myreg = /^(((13[0-9]{1})|(17[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
                if (!myreg.test(fm.mobile.value)) {
                    layer.msg('请输入有效的手机号码！');
                    return false;
                }
                if(fm.name.value==''){
                    layer.msg('请填写姓名');
                    return false;
                }

                $(".subBtn").attr('disabled',true);//禁用按钮
                $("#oneForm").ajaxSubmit(twooptions);
            });
        });

    </script>
    <script src="/home/js/sendcode.js"></script>
@endsection

